package com.wn32.main;

import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
	// write your code here
        while(true) {
            System.out.println("---欢迎来到XXX管理系统----");
            System.out.println("输入1查询所有用户");
            System.out.println("输入2新增用户");
            int num = new Scanner(System.in).nextInt();
            if (num == 1) {
                List<Person> personList = PersonDao.selectAll();
                for (Person p:personList) {
                    System.out.println(p);
                }
            } else if (num == 2) {
                System.out.println("请输入姓名");
                String name = new Scanner(System.in).next();
                System.out.println("请输入性别");
                String sex = new Scanner(System.in).next();
                Person person = new Person(PersonDao.getId(), name, sex);
                PersonDao.add(person);
                System.out.println("添加成功");
            }
            continue;
        }
    }
}
